<?php
/*
 * This is main page for Vaccinations.
 */
include 'all.php';
$tvac = true;
include '../../include/config.php';
?>

<?php include '../head.php'; ?>
<title>VACCINATIONS</title>
<style>
    .bb th, .bb td{
        border-bottom: 1px #000000 dotted !important;
        text-align: center;
    }
</style>

<body>
    <div id="wrapper">

        <?php include '../header_profile.php'; ?>
        <?php include '../menu_left.php'; ?>
        <div class="salus_bank_reg float_left">


            <a class="float_left" href="http://<?= $_SERVER['HTTP_HOST'] ?>/salusbaby/user" style="margin-left: 1%; margin-right: 1%;">
                <!--                    <div class="salus_bank_logo logo"></div>-->
                <img src="../../include/images/baby.png" width="104px;" height="50px;" />
                <div class="down_arrow"></div>
            </a>
            <?php
            $getme = mysql_query("select * from salus_buy_product where FK_fa_user_id='" . $_COOKIE['gid'] . "' and product_id ='1'  ") or die(mysql_error());
            if (mysql_num_rows($getme) != 0) {
                ?>
                <a class="float_left" href="http://<?= $_SERVER['HTTP_HOST'] ?>/salusme" style="margin-left: 1%; margin-right: 1%;" >
                    <img src="../../include/images/me.png" width="104px;" height="50px;" />
                </a>
            <?php }
            ?>
            <div class="clear"></div>

            <div class="float_left top_menu "><a href="Vaccinations">VACCINATIONS</a></div>

            <div class="clear"></div>
            <script>
                $(function(){
                    $('#dlg').click(function(){$('#dialog').dialog('open');return false;});
                    $('#dlg2').click(function(){$('#dlgw').dialog('open');return false;});
                    $('#dlgw').dialog({autoOpen : false});
                    $("#dialog").dialog({
                        autoOpen : false,
                        modal : true,
                        width : 'auto',
                        height: 'auto',
                        resizable : false,                       
                        buttons: {                           
                            "Don't Save": function() {
                                $(this).dialog("close");
                            }
                        }
                    });
                    $( "#datepicker1,#datepicker2,#datepicker3" ).datepicker({
                        showOn: "button",
                        buttonImage: "../../include/images/calendar.gif",
                        buttonImageOnly: true
                    });
                });
            </script>


            <div class="float_right" style="width: 210px">

        <!--        <div class="float_right top_after_menu"><a href="http://www.ndroid360.com/salus/index.php/salus_bank/gen_pdf"><img id="send_mail" src="http://www.ndroid360.com/salus/public/frontend/images/icons/send.png" title="Send Email"/></a></div>-->
                <form id="ffr" name="ffr" method="post" action="#">

                    <input type="hidden" id="maildata" name="maildata">
                    <div class="float_right top_after_menu"><a><img onclick="javascript:document.ffr.submit();"  id="send_mail" src="../../include/images/send.png" title="Send Email"/></a></div>

                </form>
                <div class="float_right top_after_menu"><a><img onclick="PrintElem('#mainContent')" src="../../include/images/print.png" title="Print"/></a></div>
                <div class="float_right top_after_menu"><a href="#"><img src="../../include/images/import.png" title="Import"/></a></div>                
                <div class="float_right top_after_menu"><a  href="#" id="dlg" ><img src="../../include/images/new.png" title="New"/></a></div>
            </div>


            <div class="clear"></div>
            <hr>



            <div id="mainContent">                                       

                <?php if ($_GET['p'] != 'edit') { ?>   


                    <table style=" width: 100%; " class="bb" >
                        <tr>
                            <th style="width: 10px;">Sr</th>
                            <th style="width: 230px;">Vaccination</th>
                            <th style="width: 30px;">1st vacc</th>
                            <th style="width: 100px;">Recall <br> Date</th>
                            <th style="width: 100px;">Date 2° Recall</th>
                            <th style="width: 100px;">Date 3° Recall</th>                            
                            <th style="width: 70px;">do</th>
                        </tr>

                        <?php
                        $sr = 1;
                        $getallvacc = mysql_query("select * from baby_user_vaccins where bid='" . $_COOKIE['bid'] . "'");
                        while ($al = mysql_fetch_array($getallvacc)) {
                            ?>

                            <tr>
                                <td style="width: 10px;"><?= $sr ?></td>
                                <td style="width: 230px;"><?= $al['vcc_name'] ?></td>
                                <td style="width: 30px;"><?= $al['first_vaccin'] ?></td>
                                <td style="width: 100px;"><?= $al['recall_date'] ?></td>
                                <td style="width: 100px;"><?= $al['date_2_recall'] ?></td>
                                <td style="width: 100px;"><?= $al['date_3_recall'] ?></td>
                                <td style="width: 70px;">
                                    <ul id="icons" class="ui-widget ui-helper-clearfix">                                
        <!--                                        <li class="ui-state-default ui-corner-all" title="View"><a href="#" id="dlg2"><span class="ui-icon ui-icon-extlink"></a></span></li>-->
                                        <li class="ui-state-default ui-corner-all" title="Edit"><a href="?p=edit&bid=<?= $al['bid'] ?>&vcc=<?= $al['sr'] ?>"><span class="ui-icon ui-icon-gear"></a></span></li>
                                        <li class="ui-state-default ui-corner-all" title="Delete"><a href="../vaccination/delete.php?bid=<?= $al['bid'] ?>&vcc=<?= $al['sr'] ?>"><span class="ui-icon ui-icon-trash"></a></span></li>
                                    </ul>
                                </td>
                            </tr>
                            <?php
                            $sr++;
                        }
                        ?>
                    </table>
                    <?php
                } else {
                    $getedit = mysql_query("select * from baby_user_vaccins where bid='" . $_GET['bid'] . "' and sr = '" . $_GET['vcc'] . "'") or mysql_error();
                    while ($edits = mysql_fetch_array($getedit)) {
                        ?>
                        <form method="post" action="../vaccination/edit.php">
                            <table border="0"  style="width: 400px; margin-left: 100px; ">
                                <tr>
                                    <td>Vaccine Name :</td>
                                    <td><input type="text" name="vcc_name" placeholder="New Vaccine Name" value="<?= $edits['vcc_name'] ?>"  required /> </td>
                                </tr>
                                <tr>
                                    <td>First Vaccine ? : </td>
                                    <td><input type="text"  placeholder="Enter either Y or N" name="first_vaccin"  value="<?= $edits['first_vaccin'] ?>"  required /> </td>
                                </tr>
                                <tr>
                                    <td>Recall Date :</td>
                                    <td><input type="text" placeholder="mm/dd/yyyy" name="recall_date" id="datepicker1" value="<?= $edits['recall_date'] ?>" required /></td>
                                </tr>
                                <tr>
                                    <td>Date 2° Recall :</td>
                                    <td><input type="text" placeholder="mm/dd/yyyy" name="date_2_recall" id="datepicker2" value="<?= $edits['date_2_recall'] ?>" required /> </td>
                                </tr>     
                                <tr>
                                    <td>Date 3° Recall :</td>
                                    <td><input type="text" placeholder="mm/dd/yyyy" name="date_3_recall" id="datepicker3" value="<?= $edits['date_3_recall'] ?>" required /> </td>
                                </tr>                                    
                                <td>
                                    <input type="hidden" name="sr" value="<?= $edits['sr'] ?>" />
                                </td>
                                <td><input type="submit" value="Update" style="float: right;" /></td>
                                </tr>
                            </table>
                        </form>


                        <?php
                    }
                }
                ?>
            </div>


            <div id="dialog" title="Enter New Vaccine Info" >
                <p>
                <form id="new_task" name="new_vaccine" method="post" action="../vaccination/new.php" >
                    <table>
                        <tr>
                            <td>Vaccine Name :</td>
                            <td><input type="text" placeholder="vaccination name" name="vcc_name" required /></td>
                        </tr>                        
                        <tr>
                            <td>First Vaccine ? :</td>
                            <td><input type="text" placeholder="either Y or N" name="first_vaccin"  required /></td>
                        </tr>
                        <tr>
                            <td>Recall Date :</td>
                            <td><input type="text" placeholder="mm/dd/yyyy" name="recall_date" id="datepicker1" required /></td>
                        </tr>
                        <tr>
                            <td>Date 2° Recall :</td>
                            <td><input type="text" placeholder="mm/dd/yyyy" name="date_2_recall" id="datepicker2" required /> </td>
                        </tr>                        
                        <tr>
                            <td>Date 3° Recall :</td>
                            <td><input type="text" placeholder="mm/dd/yyyy" name="date_3_recall" id="datepicker3" required /> </td>
                        </tr>                        
                        <tr>
                            <td></td><td><input type="submit" value="Create Entry" /></td>
                        </tr>
                    </table>

                </form>
                </p>
            </div>

        </div><!-- wrapper over    -->


        <div id="dlgw" >
            <p>hiii</p>
        </div>

        <?php
        include '../../include/config.php';
        include '../menu_right.php';
        ?>
</body>
</html>